package com.example.httpdemo.service.impl;

import com.example.httpdemo.service.HttpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class HttpServiceImpl implements HttpService {
    // 注入resttemplate
    @Autowired
    private RestTemplate restTemplate;
    @Override
    public void sendMessage() {
        String url = "https://fwalert.com/2bb979e6-f9e0-4b59-a71d-6ae0244e9f56?message=hello";
        // 发送请求
        String result = restTemplate.getForObject(url,String.class);
        System.out.println("收到返回的结果是: "+ result);
    }
}
